{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 准备数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "data = np.array([1.2,2.2,3.1,4.5,5.6,6.7,7.1,8.2,9.6,10.6,11,12.4,13.5,14.7,15.2])#总数据\n",
    "x = data[0:10]#输入数据\n",
    "y = data[10:]#需要预测的数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 进行预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "真实值: [11.  12.4 13.5 14.7 15.2]\n",
      "预测值: [13.1 15.4 17.9 21.  24.5]\n",
      "{'a': {'value': -0.15593384339023364, 'desc': '发展系数'}, 'b': {'value': 2.7961956194257107, 'desc': '灰色作用量'}, 'predict': {'value': array([13.13683292, 15.35365877, 17.94457149, 20.97269783, 24.5118171 ]), 'desc': '往后预测5个的序列'}, 'C': {'value': 0.04855650314239575, 'desc': '后验差比<=0.35，模型精度等级为好'}}\n"
     ]
    }
   ],
   "source": [
    "from GM11 import GM11\n",
    "result = GM11(x,len(y))#预测结果,一阶差分偏自相关图,一阶差分自相关图\n",
    "predict = result['predict']['value']\n",
    "predict = np.round(predict,1)\n",
    "print('真实值:',y)\n",
    "print('预测值:',predict)\n",
    "print(result)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
